<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <style>
      .header {
        width: 150px;
        height: 150px;
        border-radius: 10px;
        margin: 5px;
      }
    </style>
  </head>
  <body>
    <div id="app"></div>
    <!-- 依次引入react核心依赖、react DOM依赖、babel依赖(注意引入顺序)-->
    <script src="./react.development.js"></script>
    <script src="./react-dom.development.js"></script>
    <script src="./babel.min.js"></script>
    <!-- JSX基本语法 -->
    <script type="text/babel">
      // 1、插值表达式
      const user = {
        name: '大牧',
        age: 18,
        gender: 'male',
        img: './images/header.jpg'
      }

      // 头像样式
      const imgStyle = { width: 120, height: 120, borderRadius: 5 }

      // 声明式UI中使用
      const div = (
        <div>
          <p>姓名：{user.name}</p>
          <p>年龄：{user.age}</p>
          <p>性别：{user.gender}</p>
          <p>
            头像：绑定属性，属性值两侧不能添加引号
            <img src={user.img} style={{ width: 100, height: 100 }} />
            <img src={user.img} style={imgStyle} />
            <img src={user.img} className='header' />
          </p>
        </div>
      )

      // 渲染展示数据
      ReactDOM.render(div, document.getElementById('app'))
    </script>
  </body>
</html>
